<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateChatCustomerServiceUserTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('chat_customer_service_user', ['comment' => '客服用户', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci']);
        $table->addColumn('customer_service_id', 'integer', ['limit'  =>  11, 'default' => 0, 'comment' => '客服'])
            ->addColumn('auth', 'string', ['limit'  =>  60, 'null' => true, 'default' => null, 'comment' => '认证类型'])
            ->addColumn('auth_id', 'integer', ['limit'  =>  11, 'default' => 0, 'comment' => '认证用户'])
            ->addColumn('create_time', 'integer', ['limit'  =>  10, 'null' => true, 'default' => null, 'comment' => '创建时间'])
            ->addColumn('update_time', 'integer', ['limit'  => 10, 'null' => true, 'default' => null, 'comment' => '更新时间'])
            ->addIndex('customer_service_id')
            ->addIndex(['auth', 'auth_id'])
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('chat_customer_service_user');
        $table->drop();
    }
}
